<template>
  <div>
    <!-- 日期选择器 -->
    <div class="query-header">
      <span class="text">时间范围</span>
      <el-date-picker
        v-model="time"
        type="daterange"
        range-separator="至"
        start-placeholder="开始日期"
        end-placeholder="结束日期"
      >
      </el-date-picker>

      <el-button type="primary" class="query-btn" @click="queryData"
        >查询</el-button
      >
    </div>
  </div>
</template>

<script>
export default {
  props: {
    time: {
      type: Array,
      default: () => {
        return [];
      },
    },
  },
  methods: {
    queryData() {
      this.$emit("query", this.time);
    },
  },
};
</script>

<style lang="less" scoped>
.query-header {
  .text {
    margin-right: 10px;
  }

  /deep/.el-date-editor .el-range-separator {
    width: 20%;
  }

  .query-btn {
    margin-left: 10px;
  }
}
</style>